﻿/**
 * ...
 * @author aboutwhat
 */

package ;
import haxe.Resource;
import haxe.xml.Fast;
import neko.io.File;
import neko.Lib;
import neko.Sys;

class TemplateMaker 

{

	public static var elems:List<Fast>;
	
	public static function create ():Void 
	{
		var templateData = new Fast(Xml.parse(Resource.getString("templates")));
		elems = templateData.node.templates.nodes.template;
		printElems();
		
	}
	
	static private function printElems():Void
	{
		var index : Int = 0;
		for (i in elems) {
			index++;
			Lib.println(index + ". " + i.node.name.innerData);
			
		}
		Lib.print("Please choose a template or filter with (tags=tag1,tag2,...):");
		var selected = Std.parseInt(File.stdin().readLine());
		
		if (selected >= 1 && selected <= index) {
			trace(selected);
		} else {
			Lib.println("Invalid Index, please choose again");
			printElems();
		}
		
		
		
	}
	private function new ()
	{
		
	}
	
}